package com.itheima.sh.controller;

import com.itheima.sh.client.FeignUserApi;
import com.itheima.sh.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.ServiceInstance;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("myFeign")
public class FeignController {

    @Resource
    FeignUserApi feignUserApi;

    @GetMapping("{id}")
    public User queryById(@PathVariable("id") String username){

        User user = feignUserApi.queryById(username);
        return user;
    }
}
